<?php
/*************************************************************************
Login module
----------------------------------------------------------------
Vnnavi 2008 Project
Company: Derasoft Co., Ltd                                  
Email: info@derasoft.com                                    
Last updated: 02/07/2008
**************************************************************************/
include_once(ROOT_PATH."classes/dao/members.class.php");

$templateFile = "login.temp.html";
$template->assign("usertemplate",$userTemplate);
$error ='';

$site = $request->element("site");
if(!$site) $site = '';
if(!$_POST) {
	#$template->assign("error",$messages["invalid_user_password"]);
} else {
	#
	$username = trim($request->element("username"));
	$password = trim($request->element("password"));
	$users = new Members();
	$userId = $users->authenticateUser($username,$password);
	if($userId) {#die('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
		$_SESSION['memberId'];
		$_SESSION['memberId'] = $userId;
		#$url =$customDomain?"http://".$customDomain:"/";
		header('location: '.ADMIN_SCRIPT.'?op=index');
	} else {
		/*$_SESSION['memberId'] = 0;
		$error = $messages["invalid_user_password"];*/
		header('location: '.ADMIN_SCRIPT.'?op=index');
	}
	$template->assign("error",$error);	
}
?>